﻿<UserControl x:Class="Workbench.Presentation.LemmatizerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:Workbench.Presentation"
             xmlns:uc="clr-namespace:Workbench.Presentation.UserContols"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="700">
    <UserControl.Resources>
        <vm:EnumToBoolConverter x:Key="enumConverter" />
    </UserControl.Resources>
    <DockPanel Margin="5">
        <StackPanel Orientation="Vertical"  DockPanel.Dock="Top">
            <uc:FileSelectView DataContext="{Binding FileSelectViewModel}"></uc:FileSelectView>
            <GroupBox IsEnabled="{Binding HasSelectedFile}"  Header="Sentence">
                <uc:SentenceView DataContext="{Binding SentenceViewModel}"></uc:SentenceView>
            </GroupBox>
        </StackPanel>
        <Grid IsEnabled="{Binding HasSelectedFile}" DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="150"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <GroupBox Margin="5" Padding="5"  Grid.Column="0" Grid.Row="0" Header="Word form">
                <uc:ProcessWordsListView DataContext="{Binding WordsListViewModel}"></uc:ProcessWordsListView>
            </GroupBox>
            <StackPanel Margin="10" Grid.Column="1" Grid.Row="0" Orientation="Vertical">
                <Button Margin="10 30 10 0" Command="{Binding SetBaseFormCommand}">Set</Button>
                <Button Margin="10 15 10 20" Command="{Binding UnSetBaseFormCommand}">Clear Set</Button>
                <GroupBox Padding="5" Header="Operation context">
                    <StackPanel >
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter},
                                                    ConverterParameter=Selection}" Content="Selection"></RadioButton>
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter}, 
                                                    ConverterParameter=CurrentFile}" Content="Current File"></RadioButton>
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter}, 
                                                    ConverterParameter=AllFiles}" Content="All files"></RadioButton>
                    </StackPanel>
                </GroupBox>
            </StackPanel>
            <GroupBox Grid.Column="2" Margin="5" Padding="5" Header="Base Form">
                <DockPanel>
                    <DockPanel DockPanel.Dock="Top">
                        <Button Padding="5 0" DockPanel.Dock="Right" Command="{Binding AddBaseFormCommand}">_Add</Button>
                        <Button Padding="5 0" DockPanel.Dock="Right" Command="{Binding RemoveBaseFormCommand}">_Rem</Button>
                        <TextBox Text="{Binding Path=CurrentBaseFormContent, UpdateSourceTrigger=PropertyChanged}" DockPanel.Dock="Left" HorizontalAlignment="Stretch"></TextBox>
                    </DockPanel>
                    <ListBox DockPanel.Dock="Bottom" ItemsSource="{Binding CurrentBaseForms}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="IsSelected" Value="{Binding IsSelected}"></Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Content}"></TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </DockPanel>
            </GroupBox>
        </Grid>
    </DockPanel>
</UserControl>
